CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(Spear)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/modules)

FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLUT REQUIRED)
FIND_PACKAGE(OpenAL REQUIRED)

INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})

if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
    SET(FREEBSD true)
endif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")

IF (APPLE)
    ADD_DEFINITIONS(-DMACOS_X)
ENDIF (APPLE)

IF (WIN32)
    ADD_DEFINITIONS(
        -DWIN32
        -D_WINDOWS
        -D_CRT_SECURE_NO_DEPRECATE
        -D_CRT_NONSTDC_NO_DEPRECATE
        -D_USE_32BIT_TIME_T
        )
ENDIF (WIN32)

IF (DEDICATED)
    ADD_DEFINITIONS(-DID_DEDICATED)
ENDIF (DEDICATED)

INCLUDE_DIRECTORIES(.)

ADD_SUBDIRECTORY(game)
ADD_SUBDIRECTORY(idlib)
ADD_SUBDIRECTORY(sys)
ADD_SUBDIRECTORY(sound/OggVorbis)
